<template>
  <div class="shops-bottom">
    <ul>
      <li
        v-for="item in arr"
        :key="item.id"
        @click="router.push({ path: `details/${item.id}` })"

      >
        <div
          class="title-pic"
          v-show="item.isHotSale !== 0 || item.isLatest !== 0"
        >
          <img
            src="../../../public/images/section_hot.png"
            v-if="item.isHotSale === 1"
            alt=""
          />
          <img
            src="../../../public/images/section_new.png"
            v-if="item.isLatest === 1"
            alt=""
          />
        </div>
        <div class="pic">
          <img :src="`${proxy.$url}${item.coverImg}`" alt="" />
        </div>
        <span>{{ item.name }}</span>
        <span>{{ item.coin }}积分</span>
        <div class="button">
          立即兑换
        </div>
      </li>
    </ul>
    
  </div>
</template>

<script setup lang="ts">
import { getCurrentInstance } from 'vue'
import { useRouter } from 'vue-router'

const { proxy } = getCurrentInstance() as { proxy: any }

const router = useRouter()

defineProps({
  arr: Object,
  default: [],
})
</script>

<style lang="less" scoped>
.shops-bottom {
  ul {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 1200px;
    li {
      width: 285px;
      display: flex;
      flex-direction: column;
      background-color: #fff;
      align-items: center;
      padding-bottom: 32px;
      margin-right: 20px;
      margin-top: 22px;
      position: relative;

      &:nth-of-type(4n) {
        margin-right: 0;
      }
      .title-pic {
        position: absolute;
        top: 0;
        left: 0;
      }
      .pic {
        width: 100%;
        height: 330px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      span {
        &:nth-of-type(1) {
          padding-top: 22px;
          font-size: 18px;
          color: #333333;
        }
        &:nth-of-type(2) {
          margin-top: 16px;
          font-size: 18px;
          color: #fd604d;
          font-weight: bold;
        }
      }
      .button {
        width: 100px;
        height: 36px;
        margin-top: 20px;
        border: 1px solid #0a328e;
        line-height: 36px;
        text-align: center;
        color: #0a328e;
        cursor: pointer;
        &:hover {
          background-color: #0a328e;
          color: #fff;
        }
      }

      &:hover {
        transform: translateY(-23px);
        transition: transform 0.5s linear;
      }
    }
  }
 
}
</style>
